import java.util.Scanner;

public class java2 {
    public static void main(String[] args) {
//        Scanner sc = new Scanner(System.in);
//        System.out.println("请输入数字");
//        double num = sc.nextDouble();
//        System.out.println("num");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数字");
        double num = sc.nextDouble();
        System.out.println("请输入数字");
        double num2 = sc.nextDouble();
//        boolean bo=num==3 ||num2==3 ||(num+num2)%3==0;
        boolean bo = num==3 || num2==3 ||(num+num2)%3==0;
        System.out.println(bo);

    }
}
